package com.itheima.dao;

import com.itheima.pojo.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {

    @Insert("insert into tb_brand values(null,#{brand_name},#{company_name},#{ordered},#{description},#{status})")
    public int save(Book book);

    @Update("update set tb_brand brand_name=#{brand_name},company_name=#{company_name},ordere#{ordered},description=#{description},status=#{status} where id=#{id}")
    public int update(Book book);

    @Delete("delete from tb_brand id=#{id}")
    public int delete(Integer id);

    @Select("select * from tb_brand where id=#{id}")
    public Book getById(Integer id);

    @Select("select * from tb_brand")
    public List<Book> getAll();

//    //@Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
//    @Insert("insert into tb_brand (type,name,description) values(#{type},#{name},#{description})")
//    public int save(Book book);  //返回值表示影响的行数
//
//    @Update("update tb_brand set type = #{type}, name = #{name}, description = #{description} where id = #{id}")
//    public int update(Book book);
//
//    @Delete("delete from tb_brand where id = #{id}")
//    public int delete(Integer id);
//
//    @Select("select * from tb_brand where id = #{id}")
//    public Book getById(Integer id);
//
//    @Select("select * from tb_brand")
//    public List<Book> getAll();
}
